package com.itheima.stringbuilder;

public class StringBuilderDemo {
    public static void main(String[] args) {

        method();
        /*long start = System.currentTimeMillis();
        StringBuilder s1 = new StringBuilder();

        for (int i = 1; i <= 50000 ; i++) {
            s1.append(i);
        }
        System.out.println(s1);
        long end = System.currentTimeMillis();
        System.out.println(end-start);*/

    }

    private static void method() {
        long start = System.currentTimeMillis();
        String s = "";
        for (int i = 1; i <= 50000 ; i++) {
            s+=i;
        }
        System.out.println(s);
        long end = System.currentTimeMillis();
        System.out.println(end-start);
    }
}
